#include "config.h"

Config* Config::_instance = 0;

Config* Config::Instance()
{
	if (_instance == 0)
	{
		_instance = new Config();
	}
	return _instance;
}

Config::Config()
{
	char szAppName[MAX_PATH];
	_getcwd(szAppName, MAX_PATH);
	strcat(szAppName, "\\config.ini");
	::MultiByteToWideChar(CP_ACP, NULL, szAppName, 155, temp, 155); 

	_width = ::GetPrivateProfileInt(
		L"gameConfig",
		L"width",
		10,
		temp);
	_height = ::GetPrivateProfileInt(
		L"gameConfig",
		L"height",
		10,
		temp);
	cout << _width << _height;
}

bool Config::saveConfig()
{
	::WritePrivateProfileString(
		L"gameConfig",
		L"width1",
		L"640",
		temp
		);
	::WritePrivateProfileString(
		L"gameConfig",
		L"height",
		L"480",
		temp
		);
	return true;
}
